public class TwoNum {

    public static int[] findNum(int[] nums,int tar){
        int[] result=new int[2];
        for (int i = 0; i <nums.length ; i++) {
            for (int j = i+1; j <nums.length ; j++) {
                if(nums[i]+nums[j]==tar){
                    result[0]=i+1;
                    result[1]=j+1;
                    break;
                }
            }
        }
        return result;
    }

    public static void main(String[] args) {
        int[] nums = {2,3,4};
        findNum(nums,6);
    }
}
